home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / CAppendiceProspettiveViewer.as < prev    next >
Text File  |  2007-11-08  |  7KB  |  237 lines

  1. class CAppendiceProspettiveViewer extends mx.core.UIObject
  2. {
  3.    var mAutoStart = true;
  4.    var mStreaming = true;
  5.    var mFrame = 1;
  6.    function CAppendiceProspettiveViewer()
  7.    {
  8.       super();
  9.       this.mAutoStart = true;
  10.       this.mStreaming = true;
  11.       this.Hide();
  12.       this.doLater(this,"init");
  13.    }
  14.    function init(Void)
  15.    {
  16.       this.mGrabAlpha = 10;
  17.       this.mc_LemmiCorrelatiMenu.mType = "pullUp";
  18.       this.mc_LemmiCorrelatiMenu.addEventListener("scrollableMenuItemSelected",mx.utils.Delegate.create(this,this.onLemmaCorrelatoSelected));
  19.       this.mc_LemmiCorrelatiMenu.setIconFunction(this.IconManager);
  20.       this.mc_LemmiCorrelatiMenu.setCellRenderer("HtmlMenuCellRenderer",_global.gUseEmbeddedFont);
  21.       this.mc_LemmiCorrelatiMenu.mShowGrabRect = true;
  22.       this.mc_Display.addEventListener("onDisplayEvent",mx.utils.Delegate.create(this,this.onDisplayEvent));
  23.       this.mc_Controller.addEventListener("onControllerEvent",mx.utils.Delegate.create(this,this.onControllerEvent));
  24.       this.mc_BtnTornaARicerca.addEventListener("click",mx.utils.Delegate.create(this,this.Back));
  25.       this.mc_CbtnVociCorrelate.SetCallBack(this,this.onVociCorrelateClick);
  26.       this.mc_Titolo.html = true;
  27.       this.mc_Titolo.embedFonts = _global.gUseEmbeddedFont;
  28.       this.mc_Titolo.styleSheet = _global.gStyleManager.GetCSS();
  29.       this.mc_LblTipo.html = true;
  30.       this.mc_Sfondo.onPress = this.ClickGrab;
  31.       this.mc_Sfondo.useHandCursor = false;
  32.    }
  33.    function ClickGrab()
  34.    {
  35.    }
  36.    function LayoutWindow()
  37.    {
  38.       var _loc2_ = {x:0,y:0};
  39.       this.globalToLocal(_loc2_);
  40.       this.mc_GrabRect._x = _loc2_.x;
  41.       this.mc_GrabRect._y = _loc2_.y;
  42.       this.mc_GrabRect._width = Stage.width;
  43.       this.mc_GrabRect._height = Stage.height;
  44.       this.mc_GrabRect.onPress = function()
  45.       {
  46.          this._parent.NextFrame();
  47.       };
  48.       this.mc_GrabRect.useHandCursor = false;
  49.       this.mc_GrabRect._alpha = this.mGrabAlpha;
  50.       this.mc_GrabRect._visible = true;
  51.    }
  52.    function MostraProspettiva(inContributo, inFrom)
  53.    {
  54.       this.mProspettiva = inContributo;
  55.       this.mc_Controller.SetEnabled(false);
  56.       this.mc_Display.SetMedia(inContributo.GetPath(),false,false,false);
  57.       this.mc_ImageGallery.ShowGallery(inContributo,inFrom);
  58.       this.mc_BtnTornaARicerca.SetState(inFrom);
  59.       this.mc_CbtnVociCorrelate.SetEnabled(this.mProspettiva.mLemmiCorrelati.length > 0);
  60.       this.LayoutWindow();
  61.       this.mc_Titolo.htmlText = "<span class=\'s_titoloContributo\'>" + inContributo.mTitolo + "</span>";
  62.       this.mc_Titolo.hscroll = 0;
  63.       if(inContributo.mStatus != undefined && inContributo.mStatus != null)
  64.       {
  65.          this.SetStatus(inContributo.mStatus);
  66.       }
  67.       this._visible = true;
  68.       this.dispatchEvent({type:"onXXIWindowMessage",target:this,windowName:"prospettive",action:"open"});
  69.    }
  70.    function SetStatus(inStatus)
  71.    {
  72.    }
  73.    function Hide(Void)
  74.    {
  75.       this._visible = false;
  76.    }
  77.    function Close(Void)
  78.    {
  79.       this.Hide();
  80.       this.mc_Display.ReleaseMemory();
  81.       this.mc_ImageGallery.ReleaseMemory();
  82.       this.mc_LemmiCorrelatiMenu.ReleaseMemory();
  83.       this.dispatchEvent({type:"onXXIWindowMessage",target:this,windowName:"prospettive",action:"close"});
  84.    }
  85.    function PlayMovie()
  86.    {
  87.       this.mc_Display.Play();
  88.       this.mc_Controller.onStateChange("play");
  89.    }
  90.    function StopMovie()
  91.    {
  92.       this.mc_Display.Stop();
  93.       this.mc_Controller.onStateChange("pause");
  94.    }
  95.    function PauseMovie()
  96.    {
  97.       this.mc_Display.Pause();
  98.       this.mc_Controller.onStateChange("pause");
  99.    }
  100.    function onVociCorrelateClick()
  101.    {
  102.       if(this.mProspettiva.mLemmiCorrelati.length > 0)
  103.       {
  104.          this.mc_LemmiCorrelatiMenu.Show(this.mProspettiva.mLemmiCorrelati,-1);
  105.       }
  106.    }
  107.    function onLemmaCorrelatoSelected(ev)
  108.    {
  109.       if(!_root.gAppendiceSearch)
  110.       {
  111.          return undefined;
  112.       }
  113.       var _loc5_ = ev.data.codice;
  114.       var _loc2_ = ev.data.tipo;
  115.       if(_loc2_ == undefined)
  116.       {
  117.          _loc2_ = ev.data._tipo;
  118.       }
  119.       var _loc4_ = ev.data.label;
  120.       if(_loc2_ == "L" || _loc2_ == "R")
  121.       {
  122.          _root.gAppendiceSearch.MostraLemma(_loc5_,_loc2_,_loc4_,"prospettiva",true);
  123.       }
  124.    }
  125.    function onDisplayEvent(eventObject)
  126.    {
  127.       var _loc2_ = eventObject.event;
  128.       var _loc3_ = eventObject.eventArg;
  129.       if(_loc2_ == "progess")
  130.       {
  131.          this.mc_Controller.onVideoLoad(_loc3_);
  132.       }
  133.       else if(_loc2_ == "loadingDone")
  134.       {
  135.          if(!this.mStreaming)
  136.          {
  137.             this.mc_Controller.SetEnabled(true);
  138.             this.mc_Display.GoFrameAndStop(this.mFrame);
  139.             if(this.mAutoStart)
  140.             {
  141.                this.PlayMovie();
  142.             }
  143.          }
  144.       }
  145.       else if(_loc2_ == "loadinit")
  146.       {
  147.          if(this.mStreaming)
  148.          {
  149.             this.mc_Controller.SetEnabled(true);
  150.             this.mc_Display.mc_Progress._visible = false;
  151.             if(this.mAutoStart)
  152.             {
  153.                this.PlayMovie();
  154.             }
  155.          }
  156.          this.mc_Controller.SetTimeText(this.mc_Display.mFrame,this.mc_Display.mTotalFrame);
  157.       }
  158.       else if(_loc2_ == "change")
  159.       {
  160.          var _loc4_ = this.mc_Display.mTotalFrame;
  161.          if(_loc4_)
  162.          {
  163.             var _loc5_ = 100 * _loc3_ / _loc4_;
  164.             this.mc_Controller.onScrub(_loc5_);
  165.             this.mc_Controller.SetTimeText(_loc3_,_loc4_);
  166.          }
  167.       }
  168.       else if(_loc2_ == "complete")
  169.       {
  170.          this.mc_Controller.onStateChange("pause");
  171.          _loc4_ = this.mc_Display.mTotalFrame;
  172.          this.mc_Controller.SetTimeText(_loc4_,_loc4_);
  173.       }
  174.       else if(_loc2_ == "stateChange")
  175.       {
  176.          this.mc_Controller.onStateChange(_loc3_);
  177.       }
  178.    }
  179.    function onControllerEvent(eventObject)
  180.    {
  181.       var _loc2_ = eventObject.event;
  182.       var _loc3_ = eventObject.eventArg;
  183.       if(_loc2_ == "Volume")
  184.       {
  185.          this.mc_Display.SetVolume(_loc3_);
  186.       }
  187.       else if(_loc2_ == "StartShuffle")
  188.       {
  189.          this.mc_Display.Shuffle(_loc3_);
  190.          this.mc_Controller.SetTimeText(this.mc_Display.mFrame,this.mc_Display.mTotalFrame);
  191.       }
  192.       else if(_loc2_ == "Shuffle")
  193.       {
  194.          var _loc5_ = this.mc_Display.Shuffle(_loc3_);
  195.          this.mc_Controller.SetTimeText(this.mc_Display.mFrame,this.mc_Display.mTotalFrame);
  196.       }
  197.       else if(_loc2_ == "play")
  198.       {
  199.          this.PlayMovie();
  200.       }
  201.       else if(_loc2_ == "pause")
  202.       {
  203.          this.PauseMovie();
  204.       }
  205.       else if(_loc2_ == "stopAndRewind" || _loc2_ == "stop")
  206.       {
  207.          this.StopMovie();
  208.       }
  209.    }
  210.    function Copy()
  211.    {
  212.    }
  213.    function Print()
  214.    {
  215.       var _loc1_ = false;
  216.       return _loc1_;
  217.    }
  218.    function Save()
  219.    {
  220.    }
  221.    function setEnabled(enable)
  222.    {
  223.    }
  224.    function IconManager(itemObj)
  225.    {
  226.       return "lemmaIcon";
  227.    }
  228.    function Back(Void)
  229.    {
  230.       this.Close();
  231.       if(_root.gAppendiceSearch)
  232.       {
  233.          _root.gAppendiceSearch.Back();
  234.       }
  235.    }
  236. }
  237.